<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${message("admin.member.add")}</title>


<link href="${base}/resources/admin/css/amazeui.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />

	<style type="text/css">
		.pay{
			width: 100px!important;
		}
        .text-line {
            line-height: 20px;
        }
	</style>
</head>
<body>
	<div class="path">
		<a href="${base}/asl-admin/common/index.htm">${message("admin.path.index")}</a> &raquo; ${message("admin.member.add")}
	</div>
	<form id="inputForm" action="save.htm" method="post" enctype="multipart/form-data">
		<ul id="tab" class="tab">
			<li>
				<input type="button" value="${message("admin.member.base")}" />
			</li>
            <li>
                <input type="button" value="认证信息" />
            </li>
            <li>
                <input type="button" value="资格证书" />
            </li>
            <li>
                <input type="button" value="机构证件" />
            </li>
		</ul>
		<table class="input tabContent">
            <tr>
                <th>
                    <span class="requiredField">*</span>分类:
                </th>
                <td>
                    <select name="categoryId">
                        [#list categorys as category]
                            <option value="${category.id}" >${category.name}</option>
                        [/#list]
                    </select>
                </td>
            </tr>
            <tr>
                <th>
				头像:
                </th>
                <td>
					<span class="fieldSet">
						<input type="text" name="avator" class="text" maxlength="200" title="${message("admin.product.imageTitle")}" />
						<input type="button" id="browserButton" class="button" value="${message("admin.browser.select")}" />
					</span>
                </td>
            </tr>
			<tr>
				<th>
					<span class="requiredField">*</span>手机号码:
				</th>
				<td>
					<input type="text" name="username" class="text" maxlength="20" />
				</td>
			</tr>
			<tr>
				<th>
					<span class="requiredField">*</span>${message("Member.password")}:
				</th>
				<td>
					<input type="password" id="password" name="password" class="text" maxlength="20" />
				</td>
			</tr>
			<tr>
				<th>
					<span class="requiredField">*</span>${message("admin.member.rePassword")}:
				</th>
				<td>
					<input type="password" name="rePassword" class="text" maxlength="20" />
				</td>
			</tr>
            <tr>
                <th>
                    昵称:
                </th>
                <td>
                    <input type="text" name="name" class="text" maxlength="200" />
                </td>
            </tr>
            <tr>
                <th>
                    <span class="requiredField">*</span>余额:
                </th>
                <td>
                    <input type="text" name="balance" class="text" maxlength="200" />
                </td>
            </tr>
            <tr>
                <th>
                    <span class="requiredField">*</span>积分:
                </th>
                <td>
                    <input type="text" name="point" class="text" maxlength="200" value="${point}" readonly/>
                </td>
            </tr>
            <tr>
                <th>
                    简介:
                </th>
                <td>
                    <textarea id="introduction" name="introduction" class="text text-line" style="width: 400px;height: 200px"></textarea>
                </td>
            </tr>
			<tr>
            <th>
            ${message("admin.common.setting")}:
            </th>
            <td>
                <label>
                    <input type="checkbox" name="isEnabled" value="true" checked="checked" />${message("Member.isEnabled")}
                    <input type="hidden" name="_isEnabled" value="false" />
                </label>
            </td>
        </tr>
		</table>
        <table class="input tabContent">
            <tr>
                <th>
                    类型:
                </th>
                <td>
                    <label><input type="radio" name="cerType" value="person" />老师认证</label>
                    <label><input type="radio" name="cerType" value="company" />机构认证</label>
                </td>
            </tr>
            <tr>
                <th>
                    名称:
                </th>
                <td>
                    <input type="text" name="relName" class="text" maxlength="20" />
                </td>
            </tr>
            <tr>
                <th>
                    性别:
                </th>
                <td>
                    <label><input type="radio" name="gender" value="male" />男</label>
                    <label><input type="radio" name="gender" value="female" />女</label>
                </td>
            </tr>
            <tr>
                <th>
                    微信号:
                </th>
                <td>
                    <input type="text" name="wechatName" class="text" maxlength="20" />
                </td>
            </tr>
            <tr>
                <th>
                    联系地址:
                </th>
                <td>
                    <input type="text" name="relAddress" class="text" maxlength="20" />
                </td>
            </tr>
            <tr>
                <th>
                    邮箱:
                </th>
                <td>
                    <input type="text" name="email" class="text" maxlength="20" />
                </td>
            </tr>
            <tr>
                <th>
                    专长:
                </th>
                <td>
                    <input type="text" name="speciality" class="text" maxlength="20" />
                </td>
            </tr>
            <tr>
                <th>
                    派别:
                </th>
                <td>
                    <input type="text" name="faction" class="text" maxlength="20" />
                </td>
            </tr>
            <tr>
                <th>
                    回答提问金额:
                </th>
                <td>
                    <p>风水类型:￥     <input type="text" name="payFengshui" class="text pay" value="0" maxlength="20" placeholder="风水类型" /></p>
                    <p>婚恋感情类型:￥  <input type="text" name="payGanqing" class="text pay" value="0" maxlength="20" placeholder="婚恋感情类型" /></p>
                    <p>事业财运类型:￥  <input type="text" name="payShiye" class="text pay" value="0" maxlength="20" placeholder="事业财运类型" /></p>
                    <p>其他类型:￥     <input type="text" name="payOther" class="text pay" value="0" maxlength="20" placeholder="其他类型"/></p>
                </td>
            </tr>
            <tr>
                <th>
                    联系电话:
                </th>
                <td>
                    <input type="text" name="tel" class="text" maxlength="20" />
                </td>
            </tr>
        </table>
        <table id="qualificationImageTable" class="input tabContent">
            <tr>
                <td colspan="4">
                    <a href="javascript:;" id="addQualificationImage"
                       class="button">${message("admin.product.addProductImage")}</a>
                </td>
            </tr>
            <tr class="title">
                <td>
                ${message("ProductImage.file")}
                </td>
                <th>
                    预览
                </th>
                <td>
                ${message("admin.common.delete")}
                </td>
            </tr>
        </table>
        <table id="agencyImageTable" class="input tabContent">
            <tr>
                <td colspan="4">
                    <a href="javascript:;" id="addAgencyImage"
                       class="button">${message("admin.product.addProductImage")}</a>
                </td>
            </tr>
            <tr class="title">
                <td>
                ${message("ProductImage.file")}
                </td>
                <th>
                    预览
                </th>
                <td>
                ${message("admin.common.delete")}
                </td>
            </tr>
        </table>
        </div>
		<table class="input">
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="${message("admin.common.submit")}" />
					<input type="button" class="button" value="${message("admin.common.back")}" onclick="location.href='list.htm'" />
				</td>
			</tr>
		</table>
	</form>
</body>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.tools.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.lSelect.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resources/admin/editor/kindeditor.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
<script type="text/javascript" src="${base}/resources/admin/datePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $().ready(function() {

        var $inputForm = $("#inputForm");
        var $areaId = $("#areaId");
        var $browserButton = $("#browserButton");

        var $qualificationImageTable = $("#qualificationImageTable");
        var $agencyImageTable = $("#agencyImageTable")
        var $addQualificationImage = $("#addQualificationImage");
        var $addAgencyImage = $("#addAgencyImage");
        var $deleteProductImage = $("a.deleteProductImage");
        var qualificationImageIndex = 0;
        var angencyImageIndex = 0;

    [@flash_message /]

        // 地区选择
        $areaId.lSelect({
            url: "${base}/asl-admin/common/area.action"
        });

        $browserButton.browser();

        // 表单验证
        $inputForm.validate({
            rules: {
                username: {
                    required: true,
                    pattern: /^(((13[0-9]{1})|(15[0-9]{1})|(18[0,2,3,5-9]{1})|(17[0-8]{1})|(147))+\d{8})$/,
                    minlength: ${setting.usernameMinLength},
                    maxlength: ${setting.usernameMaxLength},
                    remote: {
                        url: "check_username.action",
                        cache: false
                    }
                },
                password: {
                    required: true,
                    pattern: /^[^\s&\"<>]+$/,
                    minlength: ${setting.passwordMinLength},
                    maxlength: ${setting.passwordMaxLength}
                },
                rePassword: {
                    required: true,
                    equalTo: "#password"
                },
                balance: {
                    required: true,
                    min: 0,
                    decimal: {
                        integer: 12,
                        fraction: ${setting.priceScale}
                    }
                },
                payFengshui:{
                    digits: true
                },
                payFengshui:{
                    digits: true
                },
                payShiye:{
                    digits: true
                },
                payOther:{
                    digits: true
                }
            },
            messages: {
                username: {
                    pattern: "${message("admin.validate.illegal")}",
                    remote: "${message("admin.member.disabledExist")}"
                },
                password: {
                    pattern: "${message("admin.validate.illegal")}"
                }
            [#if !setting.isDuplicateEmail]
                ,email: {
                remote: "${message("admin.validate.exist")}"
            }
            [/#if]
            }
        });

        // 增加认证图片
        $addQualificationImage.click(function () {
        [@compress single_line = true]
            var trHtml =
                    '<tr>
                    <td>
                    <input type="file" name="qualificationImage" class="productImageFile imgChange"\/>
            <span class="tips">建议上传的图片的宽高比例为1:1<\/span>
        <\/td>
        <td>
        <div class="photoChange"><\/div>
        <\/td>
        <td>
        <a href="javascript:;" class="deleteProductImage"><i class="iconfont icon-shequshanchu del-icon"><\/i><\/a>
        <\/td>
        <\/tr>';
        [/@compress]
            $qualificationImageTable.append(trHtml);
            qualificationImageIndex++;

            $('.imgChange').change(function () {
                var file = this.files[0];
                var r = new FileReader();
                var t = $(this);
                r.readAsDataURL(file);
                $(r).load(function () {
                    t.parent().next().children('.photoChange').html('<img src="' + this.result + '" alt=""  />');
                })
            });
        });



        // 增加机构图片
        $addAgencyImage.click(function () {
        [@compress single_line = true]
            var trHtml =
                    '<tr>
                    <td>
                    <input type="file" name="agencyImage" class="productImageFile imgChange"\/>
            <span class="tips">建议上传的图片的宽高比例为1:1<\/span>
        <\/td>
        <td>
        <div class="photoChange"><\/div>
        <\/td>
        <td>
        <a href="javascript:;" class="deleteProductImage"><i class="iconfont icon-shequshanchu del-icon"><\/i><\/a>
        <\/td>
        <\/tr>';
        [/@compress]
            $agencyImageTable.append(trHtml);
            angencyImageIndex++;

            $('.imgChange').change(function () {
                var file = this.files[0];
                var r = new FileReader();
                var t = $(this);
                r.readAsDataURL(file);
                $(r).load(function () {
                    t.parent().next().children('.photoChange').html('<img src="' + this.result + '" alt=""  />');
                })
            });
        });


        // 删除图片
        $deleteProductImage.live("click", function () {
            var $this = $(this);
            $.dialog({
                type: "warn",
                content: "${message("admin.dialog.deleteConfirm")}",
                onOk: function () {
                    $this.closest("tr").remove();
                }
            }, 260, 180);
        });

    });
</script>
</html>